<template>
	<div class="wpsz">
		<div class="all">
			<div class="wpszlt">
				<div class="wpfl">物品类别</div>
			</div>
			<div class="wpszlt1">
				<el-collapse v-model="activeNames">
					<el-collapse-item style="text-align: center;" title="教材类" name="1">
						<div v-for='v in comboxlistjc' :class="v.classname" style="width: 100%; height: 40px; border-bottom: 1px solid #CCCCCC;">
							<div class="jclt" @click="wpfxbtnclickjc(v.id,'1')">{{v.mc}}
								<el-button style="width:15%; text-align: left; height:50px; float: right;" type="text" @click="componentsShow('fledit',v)" icon="el-icon-edit"></el-button>
							</div>
						</div>
						<!--<div v-if="comboxli+stjc.length<=0"  class="jc1"  style="text-align: center ;"  >本类别下暂无分类，-->
						<div class="tj" @click='componentsShow("fladd","1")'>+添加</div>
						<!--</div>-->
					</el-collapse-item>
					<el-collapse-item style="text-align: center;" title="学习用品类" name="2">
						<div v-for='v in comboxlistxx' :class="v.classname" style="width: 100%; height: 40px; border-bottom: 1px solid #CCCCCC;">
							<div class="jclt" @click="wpfxbtnclickjc(v.id,'2')">{{v.mc}}
								<el-button style="width:15%; text-align: left; height:50px; float: right;" type="text" @click="componentsShow('fledit',v)" icon="el-icon-edit"></el-button>
							</div>
						</div>
						<!--<div v-if="comboxlistxx.length<=0"  class="jc1"  style="text-align: center ;"  >本类别下暂无分类，-->
						<div class="tj" @click='componentsShow("fladd","2")'>+添加</div>
						<!--</div>-->
					</el-collapse-item>
					<el-collapse-item style="text-align: center;" title=" 固定资产类" name="3">
						<div v-for='v in comboxlistgd' :class="v.classname" style="width: 100%; height: 40px; border-bottom: 1px solid #CCCCCC;">
							<div class="jclt" @click="wpfxbtnclickjc(v.id,'34')">{{v.mc}}
								<el-button style="width:15%; text-align: left; height:50px; float: right;" type="text" @click="componentsShow('fledit',v)" icon="el-icon-edit"></el-button>
							</div>
						</div>
						<!--<div v-if="comboxlistgd.length<=0" class="jc1"  style="text-align: center ;" >本类别下暂无分类，-->
						<div class="tj" @click='componentsShow("fladd","3")'>+添加</div>
						<!--</div>-->
					</el-collapse-item>
					<el-collapse-item style="text-align: center;" title="易耗品类" name="4">
						<div v-for='v in comboxlistyh' :class="v.classname" style="width: 100%; height: 40px; border-bottom: 1px solid #CCCCCC;">
							<div class="jclt" @click="wpfxbtnclickjc(v.id,'34')">{{v.mc}}
								<el-button style="width:15%; text-align: left; height:50px; float: right;" type="text" @click="componentsShow('fledit',v)" icon="el-icon-edit"></el-button>
							</div>
						</div>
						<!--<div v-if="this.comboxlistyh.length<=0"   class="jc1" style="text-align: center ;" >本类别下暂无分类，-->
						<div class="tj" @click='componentsShow("fladd","4")'>+添加</div>
						<!--</div>-->
					</el-collapse-item>
				</el-collapse>
			</div>
			<!--<div class="wpfltj">
					<el-button type="success" size="small" class="add btn" style='margin-top:10px;background:#50BFFF;border: none;' @click='componentsShow("fladd","1")' icon="edit">+ 添加物品分类</el-button>
				</div> -->

		</div>
		<div class="port-page">
			<!-- 顶部按钮 -->
			<div class="but1">
				<router-link to="/home">
					<el-button type="warning" size="small" class="add btn" icon="el-icon-menu">首页</el-button>
				</router-link>
				<el-button type="success" size="small" class="add btn" v-if="vispj==false" @click='componentsShow("add","")' icon="el-icon-edit">添加物品</el-button>
				<el-button type="success" size="small" class="add btn" v-if="vispj==true" @click="componentsShow('pjadd',addlist)">添加配件</el-button>
				<el-button type="danger" size='small' class="add btn" :disabled="multipleDeleteDisabled" icon="delete" @click="componentsShow('plwp')">批量价格修改</el-button>
			</div>
			<!-- 模糊搜索条件 -->
			<div class="search">
				<el-button type="text" size="small" class="add btn" style=' text-decoration:underline;' v-if="ss" @click='gd'>更多</el-button>
            <el-button type="text" size="small" class="add btn" style=' text-decoration:underline;' v-if="ss1" @click='gd1'>更多</el-button>
				<div class="search-item">
					<!--<span>展示配件</span>-->
					<el-checkbox @change="search()" v-model="vispj">只显示配件</el-checkbox>
					<!--<el-tooltip placement="top" class="sx">
						<el-switch @change="search()" v-model="vispj" active-color="#ff4949" inactive-color="#13ce66" inactive-text="是" active-text="否" active-value="N" inactive-value="Y"></el-switch>
					</el-tooltip>-->
				</div>
				<div class="search-item">
					<span></span>
					<el-input placeholder="按物品名称搜索" class="code-search" v-model="vkeyword" @keyup.enter.native="search" icon="el-icon-search"></el-input>
				</div>
				<el-button type="primary" class="add btn" style='border-radius: 13px;' :loading="searchLoading" @click="search" icon="el-icon-search"></el-button>
			</div>
			
			<div class="search1" v-if='aa'>
        	<div class="search-item">
					<el-tooltip placement="top" class="sx">
						<el-switch @change="search()" v-model="vsfsj" active-color="#ff4949" inactive-color="#13ce66" inactive-text="上架" active-text="下架" active-value="N" inactive-value="Y"></el-switch>
					</el-tooltip>
				</div>
        </div>
			<!-- 数据表格展示区域 -->
			<el-table 
				:data="dataList"
				 border  
				 stripe
                 size="mini " 
                 align="left"  
                 @select="checkSelect" style="width: 100%" @select-all="checkall" :row-style="tableRowClassName">
				<el-table-column type="selection" width="35"></el-table-column>
				<div slot='empty'>
					<img src="../../../assets/img/empty.png" style="width:40px;vertical-align: middle;">
					<span style="vertical-align: middle;">暂时还没有内容哦!</span>
				</div>
				<el-table-column type="expand" label="配件" width="60" v-if="vispj==false">
					<template slot-scope="props">
						<el-table :data="props.row.sonlist" :show-header="false" border stripe align="left" size="mini " class="admin-table" @select="checkSelect" @select-all="checkall">
							<div slot='empty'>
								<img src="../../../assets/img/empty.png" style="width:40px;vertical-align: middle;">
								<span style="vertical-align: middle;">暂时还没有添加配件哦!</span>
							</div>
							<el-table-column :prop="v.prop" :label="v.label" v-for="(v,index) in portTitleList1" align="center" show-overflow-tooltip v-if="v.hide != 0" :formatter="v.formatter" :align="v.align || 'center'" :fixed="v.fixed" :class-name="v.columnStyle" :width="v.width" :min-width="v.minWidth" :header-align="v.headerAlign || 'center'">
								<template scope="scope">
									<div slot="reference" :style="tableCellControl(scope)">
										{{ scope.row[scope.column.property] }}
									</div>
								</template>
							</el-table-column>
							<el-table-column fixed="right" align="center" label="操作" width="200px">
								<template scope="scope">
									<el-button size="mini" type="warning" @click="componentsShow('edit',scope)">编辑</el-button>
									<el-button size="mini" type="danger" @click="yichupj(scope)">移除</el-button>
								</template>
							</el-table-column>
						</el-table>
					</template>
				</el-table-column>
				<el-table-column :prop="v.prop" :label="v.label" v-for="(v,index) in portTitleList" show-overflow-tooltip v-if="v.hide != 0" :formatter="v.formatter" :align="v.align || 'center'" :fixed="v.fixed" :class-name="v.columnStyle" :width="v.width" :min-width="v.minWidth" :header-align="v.headerAlign || 'center'">
					<template scope="scope">
						<div slot="reference" :style="tableCellControl(scope)">
							{{ scope.row[scope.column.property] }}
						</div>
					</template>
				</el-table-column>
				<el-table-column align="center" label="操作" width="170px">
					<template scope="scope">
						<el-button size="mini" type="warning" @click="componentsShow('edit',scope)">编辑</el-button>
						<el-dropdown>
							<el-button type="primary" size="mini"> 更多<i class="el-icon-arrow-down el-icon--right"></i></el-button>
							<el-dropdown-menu slot="dropdown" align="center">
								<el-dropdown-item>
									<el-button type="success" size="mini" class="add btn" v-if="scope.row.ispjmc== '否'" @click="componentsShow('pjadd',scope)">添加配件</el-button>
								</el-dropdown-item>
								<el-dropdown-item>
									<el-button size="mini" type="success" v-if="scope.row.sfsj == 'Y' ? false:true" @click="singleDelete('Y',scope)">上架</el-button>
								</el-dropdown-item>
								<el-dropdown-item>
									<el-button size="mini" type="warning" v-if="scope.row.sfsj == 'N' ? false:true" @click="singleDelete('N',scope)">下架</el-button>
								</el-dropdown-item>
								<el-dropdown-item>
									<el-button size="mini" type="danger" @click="singleDelete('D',scope)">删除</el-button>
								</el-dropdown-item>
							</el-dropdown-menu>
						</el-dropdown>
					</template>
				</el-table-column>
			</el-table>
			<!-- 分页查询区域 -->
			<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="pageindex" :page-sizes="pagesizes" :page-size="pagesize" :layout="layout" :total="total" class="class-page">
			</el-pagination>
			<!-- 各个组件显示区域 -->
			<!-- 动画加载 -->
			<!--:data="this.vispj"-->
			<LoadingComponent v-show="isLoading"></LoadingComponent>
			<!-- 添加组件 -->
			<AddComponent v-if="portComponents.add.toggle" @close="componentsHide" :params="portComponents.add.params"></AddComponent>
			<ZzComponent v-if="portComponents.zz.toggle" @close="componentsHide" :params="portComponents.zz.params"></ZzComponent>

			<PjaddComponent v-if="portComponents.pjadd.toggle" @close="componentsHide" :params="portComponents.pjadd.params"></PjaddComponent>
			<!-- 编辑组件 -->
			<PlwpComponent v-if="portComponents.plwp.toggle" @close="componentsHide" :params="this.multipleDelNum"></PlwpComponent>
			<EditComponent v-if="portComponents.edit.toggle" @close="componentsHide" :params="portComponents.edit.params"></EditComponent>
			<!-- info组件 -->
			<infoComponent v-if="portComponents.info.toggle" @close="componentsHide" :params="portComponents.info.params"></infoComponent>
			<!-- peijian组件 -->
			<peijianComponent v-if="portComponents.peijian.toggle" @close="componentsHide" :params="portComponents.peijian.params"></peijianComponent>
			<!-- pjxq组件 -->
			<pjxqComponent v-if="portComponents.pjxq.toggle" @close="componentsHide" :params="portComponents.pjxq.params"></pjxqComponent>
			<!-- 单独删除组件 -->
			<!--<DeleteComponent v-if="portComponents.singleDelete.toggle" @close="componentsHide" :data="portComponents.singleDelete.data"></DeleteComponent>-->
			<!-- 批量删除组件 -->
			<DeleteComponent v-if="portComponents.multipleDelete.toggle" @close="componentsHide" :data="portComponents.multipleDelete.data"></DeleteComponent>
			<FleditComponent v-if="portComponents.fledit.toggle" @close="componentsHide" :params="portComponents.fledit.params"></FleditComponent>
			<FladdComponent v-if="portComponents.fladd.toggle" @close="componentsHide" :params="portComponents.fladd.params"></FladdComponent>

			<!-- 子路由显示区域 -->
			<router-view class="port-view"></router-view>
		</div>
	</div>
</template>
<script>
	import { mapState } from 'vuex'
	import LoadingComponent from 'components/loading'
	import AddComponent from './add'
	import ZzComponent from './zuzhuang'
	import PjaddComponent from './pjadd'
	import EditComponent from './edit'
	import InfoComponent from './info'
	import PeijianComponent from './peijian'
	import PjxqComponent from './pjxq'
	import PlwpComponent from './plwp'
	import DeleteComponent from './del'
	import FleditComponent from './fledit'
	import FladdComponent from './fladd'
	import qs from 'qs'
	export default {
		components: {
			LoadingComponent,
			ZzComponent,
			PlwpComponent,
			FleditComponent,
			FladdComponent,
			DeleteComponent,
			AddComponent,
			EditComponent,
			InfoComponent,
			PjaddComponent,
			PeijianComponent,
			PjxqComponent
		},
		data() {
			return {
				aa:false,
			    ss:true,
			    ss1:false,
				multipleDeleteDisabled: true,
				activeNames: [''],
				/*模糊搜索条件*/
				addlist:'',
				sz: '',
				vsfsj: 'Y',
				vispj: false,
				vkeyword: '', // keyword
				vwpflid: '', // 物品分类id
				dataListleft: [],
				multipleDelNum: '', //获取批量选择的数据
				dataList: [], //表格数据
				comboxlistjc: [], //下拉框 动态的
				comboxlistxx: [], //下拉框 动态的
				comboxlistgd: [], //下拉框 动态的
				comboxlistyh: [], //下拉框 动态的
				vselectwpfxid: '',

				/*动画加载*/
				isLoading: true, //动画加载
				searchLoading: false, //搜索按钮触发按钮动画
				/*分页属性设置*/
				layout: 'total, sizes, prev, pager, next, jumper', //组件布局
				pageindex: this.$store.state.pageindex, //当前分页页码
				pagesizes: this.$store.state.pagesizes, //显示个数的选择器选项
				pagesize: this.$store.state.pagesize, //每页显示条目数
				total: 0, //总条数

				/*组件区域*/
				portComponents: {
					/* 单行删除  */
					//					singleDelete: {
					//						type: 'singleDelete',
					//						toggle: false,
					//						params: '',
					//						data: {
					//							index: '',
					//							type: 'single',
					//							title: '此操作将删除该记录?, 是否继续?'
					//						}
					//					},
					/* 批量删除 */
					multipleDelete: {
						type: 'multipleDelete',
						toggle: false,
						params: '',
						data: {
							index: '',
							type: 'multiple',
							title: '此操作将删除您选中的记录?, 是否继续?'
						}
					},
					/* 添加 */
					add: {
						type: 'add',
						toggle: false,
						params: '',
						data: {},
						flid: '',
					},
					zz: {
						type: 'zz',
						toggle: false,
						params: '',
						data: {},
						flid: '',
					},
					/* 添加 */
					pjadd: {
						type: 'pjadd',
						toggle: false,
						params: '',
						data: {},
						flid: '',
					},
					/* 编辑 */
					edit: {
						type: 'edit',
						toggle: false,
						params: '',
						data: {}
					},
					/* info */
					info: {
						type: 'info',
						toggle: false,
						params: '',
						data: {}
					},
					del: {
						type: 'del',
						toggle: false,
						params: '',
						data: {}
					},
					/* peijian */
					peijian: {
						type: 'peijian',
						toggle: false,
						params: '',
						data: {}
					},
					/* pjxq */
					pjxq: {
						type: 'pjxq',
						toggle: false,
						params: '',
						data: {}
					},
					wpcrjl: {
						type: 'wpcrjl',
						toggle: false,
						params: '',
						data: {}
					},
					fladd: {
						type: 'fladd',
						toggle: false,
						params: '',
						data: {},
					},
					fledit: {
						type: 'fledit',
						toggle: false,
						params: '',
						data: {}
					},
					plwp: {
						type: 'plwp',
						toggle: false,
						params: '',
						data: {}
					}
				},
				/*
				    prop :  接口参数名
				    label : 接口中文名
				    hide : 是否隐藏这一列
				    align : 这一列对齐顺序 ： left,right,center
				    headerAlign : 这一列表头对齐方式 ： left,right,center
				*/
				portTitleList: [

					{
						prop: 'mc',
						label: '物品名称',
						hide: 1,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '',
						headerAlign: 'center',
						formatter: function(row, column) {}
					},

					{
						prop: 'jg1',
						label: '单价/单位',
						hide: 1,
						align: 'center',
						fixed: false,
						width: '110',
						minWidth: '',
						headerAlign: 'center',
						formatter: function(row, column) {}
					},
					{
						prop: 'dw',
						label: '单位名称',
						hide: 0,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '',
						headerAlign: 'center',
						formatter: function(row, column) {}
					},
					{
						prop: 'sfsjmc',
						label: '是否上架',
						hide: 0,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '',
						headerAlign: 'center',
						formatter: function(row, column) {}
					},
					{
						prop: 'ispjmc',
						label: '配件',
						hide: 1,
						align: 'center',
						fixed: false,
						width: '80',
						minWidth: '',
						headerAlign: 'center',
						formatter: function(row, column) {}
					},
					{
						prop: 'kcsl',
						label: '库存数量',
						hide: 0,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '',
						headerAlign: 'center',
						formatter: function(row, column) {}
					},
					{
						prop: 'kcxx',
						label: '库存预警值',
						hide: 1,
						align: 'center',
						fixed: false,
						width: '110',
						minWidth: '',
						headerAlign: 'center',
						formatter: function(row, column) {}
					},

				],
				portTitleList1: [

					{
						prop: 'mc',
						label: '配件名称',
						hide: 1,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '',
						headerAlign: 'center',
						formatter: function(row, column) {}
					},

					{
						prop: 'dw',
						label: '单价/单位',
						hide: 1,
						align: 'center',
						fixed: false,
						width: '110',
						minWidth: '',
						headerAlign: 'center',
						formatter: function(row, column) {}
					},
					{
						prop: 'ispjmc',
						label: '配件',
						hide: 1,
						align: 'center',
						fixed: false,
						width: '80',
						minWidth: '',
						headerAlign: 'center',
						formatter: function(row, column) {}
					},
					{
						prop: 'kcxx',
						label: '库存预警值',
						hide: 1,
						align: 'center',
						fixed: false,
						width: '110',
						minWidth: '',
						headerAlign: 'center',
						formatter: function(row, column) {}
					},

				]
			}
		},
		created() {
			var logininfo = JSON.parse(localStorage.logininfo);
			//加载页面时调用
			this.$store.dispatch('changeTitle', '物品价格设置'); //修改title
			this.$store.dispatch('changeRouterIndex', '/manage/wpfx'); //修改路由
			this.search(); //分页获取默认数据
			this.isLoading = true; //动画开始
			this.getcomboxlist(); //加载下拉 
			
		},
		mounted() {
			//加载完成之后event
			this.isLoading = false; //动画结束
		},
		methods: {
			gd(){
        		this.aa=true;
        		this.ss=false;
        		this.ss1=true;
        	},
        	gd1(){
        		this.aa=false;
        		this.ss=true;
        		this.ss1=false;
        	},

			tableRowClassName({
				row,
				rowIndex
			}) {
				if(row.ispj == 'Y') {
					return 'background:oldlace';
				}
			},
			wpfxbtnclickjc(wpfxid, sz, vispj) {
				this.vselectwpfxid = wpfxid;
				this.sz = sz;
				this.setrowselected();
				this.search(sz);
				this.addlist = {
					vselectwpfxid: this.vselectwpfxid,
					sz: this.sz,
					vispj: this.vispj,
					vif:false,
				};
			},
			setrowselected() {
				for(let i in this.comboxlistjc) {
					this.comboxlistjc[i].classname = 'jc';
					if(this.comboxlistjc[i].id == this.vselectwpfxid) {
						this.comboxlistjc[i].classname = 'jc2';
					}
				}
				for(let i in this.comboxlistxx) {
					this.comboxlistxx[i].classname = 'jc';
					if(this.comboxlistxx[i].id == this.vselectwpfxid) {
						this.comboxlistxx[i].classname = 'jc2';
					}
				}
				for(let i in this.comboxlistgd) {
					this.comboxlistgd[i].classname = 'jc';
					if(this.comboxlistgd[i].id == this.vselectwpfxid) {
						this.comboxlistgd[i].classname = 'jc2';
					}
				}
				for(let i in this.comboxlistyh) {
					this.comboxlistyh[i].classname = 'jc';
					if(this.comboxlistyh[i].id == this.vselectwpfxid) {
						this.comboxlistyh[i].classname = 'jc2';
					}
				}
			},
			yichupj(data) {
				this.$confirm('是否确认移除该配件？', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					var logininfo = JSON.parse(localStorage.logininfo);
					this.searchLoading = true;
					var params2 = qs.stringify({
						yhid: logininfo.id,
						xxid: logininfo.xxid,
						id: data.row.id1,
					})
					//执行
					this.axios.post(this.$store.state.api + 'wpfx/ycpj', params2)
						.then(res => {
							console.log(res, 'sss')
							if(res.data.code == 1) {
								this.$message({
									message: res.data.msg,
									type: 'success'
								});
								this.search(); //分页获取默认数据
							} else {
								this.$message.error(res.data.msg);
							}
							this.searchLoading = false;
						}).catch(res => {
							this.searchLoading = false;
						})
				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消'
					});
				});
			},
			singleDelete(lx, data) {
				//查询搜索触发事件
				var add = ''
				if(lx == 'Y') {
					add = "是否确认上架该物品？"
				} else if(lx == 'N') {
					add = "是否确认下架该物品？"
				} else {
					add = "是否确认删除该物品？"
				}
				this.$confirm(add, '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					var logininfo = JSON.parse(localStorage.logininfo);
					this.searchLoading = true;
					var params2 = qs.stringify({
						yhid: logininfo.id,
						xxid: logininfo.xxid,
						id: data.row.id,
						zt: lx,
					})
					//执行
					this.axios.post(this.$store.state.api + 'wpfx/deletepj', params2)
						.then(res => {
							console.log(res, 'sss')
							if(res.data.code == 1) {
								this.$message({
									message: res.data.msg,
									type: 'success'
								});
								this.search(); //分页获取默认数据
							} else {
								this.$message.error(res.data.msg);
							}
							this.searchLoading = false;
						}).catch(res => {
							this.searchLoading = false;
						})
				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消'
					});
				});

			},
			search(sz) {
				//查询搜索触发事件
				var logininfo = JSON.parse(localStorage.logininfo);
				this.searchLoading = true;
				var params2 = qs.stringify({
					sfsj: this.vsfsj,
					keyword: this.vkeyword + '', // keyword
					wpflid: this.vselectwpfxid, // 物品分类id
					wpfl: sz,
					ispj: this.vispj,
					yhid: logininfo.id,
					xxid: logininfo.xxid,
					pageindex: this.pageindex,
					pagesize: this.pagesize
				})
				//执行
				this.axios.post(this.$store.state.api + 'wpfx/list', params2)
					.then(res => {
						console.log(res, 'sss')
						let data = res.data.data;
						let list = data.list;
						this.total = data.totalPage;
						this.dataList = list;
						this.searchLoading = false;
					}).catch(res => {
						this.searchLoading = false;
					})
			},
			getcomboxlist() {
				var logininfo = JSON.parse(localStorage.logininfo);
				this.searchLoading = true;
				var params2 = qs.stringify({
					ms: '1',
					yhid: logininfo.id,
					xxid: logininfo.xxid
				})
				//执行
				this.axios.post(this.$store.state.api + 'wpfl/getlist1', params2)
					.then(res => {
						let data = res.data.data;
						let list = data.list;
						this.comboxlistjc = list;
					}).catch(res => {
						this.searchLoading = false;
					})
				var params2 = qs.stringify({
					ms: '2',
					yhid: logininfo.id,
					xxid: logininfo.xxid
				})
				//执行
				this.axios.post(this.$store.state.api + 'wpfl/getlist1', params2)
					.then(res => {
						this.flid = res.data.data.list[0].id;
						let data = res.data.data;
						let list = data.list;
						this.comboxlistxx = list;
					}).catch(res => {
						this.searchLoading = false;
					})

				var params2 = qs.stringify({
					ms: '3',
					yhid: logininfo.id,
					xxid: logininfo.xxid
				})

				this.axios.post(this.$store.state.api + 'wpfl/getlist1', params2)
					.then(res => {
						this.flid = res.data.data.list[0].id;
						let data = res.data.data;
						let list = data.list;
						this.comboxlistgd = list;
					}).catch(res => {
						this.searchLoading = false;
					})

				var params2 = qs.stringify({
					ms: '4',
					yhid: logininfo.id,
					xxid: logininfo.xxid
				})

				this.axios.post(this.$store.state.api + 'wpfl/getlist1', params2)
					.then(res => {
						this.flid = res.data.data.list[0].id;
						let data = res.data.data;
						let list = data.list;
						this.comboxlistyh = list;
					}).catch(res => {
						this.searchLoading = false;
					})

				this.setrowselected();
			},
			tableCellControl(scope) {
				//表格单元格控制CSS样式
				/*if (scope.row.id == 112 && scope.column.property == "iname") {
				    return {
				        color:"red",
				    }
				}else{
				    return {
				        color:"green",
				    }
				}*/
			},
			handleSizeChange(val) { //每页显示条数触发事件
				this.pagesize = val;
				this.pageindex = 1;
				this.search();
			},
			handleCurrentChange(val) { //分页触发事件
				this.search();
			},
			checkSelect(selection, row) { //点击单选select触发事件 
				this.multipleDelNum = selection
				if(this.multipleDelNum.length > 0) {
					this.multipleDeleteDisabled = false
				} else {
					this.multipleDeleteDisabled = true
				}

			},
			checkall(selection) { //点击全选select触发事件 
				this.multipleDelNum = selection
				if(this.multipleDelNum.length > 0) {
					this.multipleDeleteDisabled = false
				} else {
					this.multipleDeleteDisabled = true
				}
			},
			/* 组件的弹框  */
			componentsShow(type, data) { //显示组件

				for(let i in this.portComponents) {
					if(type == this.portComponents[i].type) {
						this.portComponents[i].toggle = true;
						this.portComponents[i].params = data;
						if(this.portComponents[i].data.type == 'single') {
							this.portComponents[i].data.index = data.row.id
						} else if(this.portComponents[i].data.type == 'multiple') {
							this.portComponents[i].data.index = this.multipleDelNum;
						} else if(this.portComponents[i].type == 'add') {
							this.portComponents[i].params = {
								vselectwpfxid: this.vselectwpfxid,
								sz: this.sz,
								vispj: this.vispj
							};
						} else {
							return;
						}
						return;
					}
				}
			},
			componentsHide(setting) { //关闭组件
				this.multipleDeleteDisabled = true
				if(setting.type == "fladd") {
					this.portComponents.fladd.toggle = false;
					if(!setting.cancel) {
						//刷新分类
						this.getcomboxlist();
					}
				} else if(setting.type == "fledit") {
					this.portComponents.fledit.toggle = false;
					if(!setting.cancel) {
						//刷新分类
						this.getcomboxlist();
					}
				} else {

					for(let i in this.portComponents) {
						if(setting.type == this.portComponents[i].type) {
							this.portComponents[i].toggle = false;
							if(!setting.cancel) {
								this.search();
							}
							return;
						}
					}
				}
			}
		},
		computed: {
			...mapState([
				'api' //域名
			])
			//			,multipleDeleteDisabled() {
			//				console.log(this.multipleDelNum)
			//				if(this.multipleDelNum) {
			//					return false;
			//				} else {
			//					return true
			//				}
			//			}
		}
	}
</script>

<style lang="less" scoped>
	.wpsz {
		font-size: 12px;
		.all {
			float: left;
			font-size: 12px;
			width: 20%;
			height: 100%;
			/*border: 1px solid #CCCCCC;*/
			/*margin-right: 10px;*/
		}
		.wpszlt {
			float: left;
			font-size: 12px;
			width: 100%;
			height: 100%;
			/*border: 1px solid #CCCCCC;*/
			/*margin-right: 10px;*/
		}
		.wpszlt1 {
			float: left;
			font-size: 12px;
			width: 100%;
			height: 100%;
			/*border: 1px solid #CCCCCC;*/
			/*margin-right: 10px;*/
		}
		.wpfl {
			width: 100%;
			height: 40px;
			float: left;
			background: #58A9FC;
			color: white;
			font-size: 16px;
			text-align: center;
			line-height: 40px;
			border-bottom: 1px solid #CCCCCC;
		}
		.wpfltj {
			width: 100%;
			height: 40px;
			float: left;
			background: white;
			font-size: 16px;
			text-align: center;
			line-height: 50px;
			border-bottom: 1px solid #CCCCCC;
			cursor: pointer;
		}
		.tj {
			width: 100%;
			height: 40px;
			line-height: 40px;
			/*margin-top:10px;*/
			font-size: 16px;
			cursor: pointer;
			text-align: center;
			background: #67C23A;
			color: white;
			float: left;
		}
		.jc {
			width: 100%;
			height: 40px;
			float: left;
			background: whitesmoke;
			/*border: 1px solid #CCCCCC;*/
		}
		.jc2 {
			width: 100%;
			height: 40px;
			float: left;
			color: white;
			background: #71BFF4;
			/*border: 1px solid #CCCCCC;*/
		}
		.jc:hover {
			background: #9FC9F9;
		}
		.jclt {
			width: 100%;
			height: 40px;
			/*color: #2E2F2F;*/
			float: left;
			text-align: center;
			line-height: 40px;
			font-size: 12px;
			/*border: 1px solid #CCCCCC;*/
			cursor: pointer;
		}
		.port-page {
			font-size: 12px;
			width: 80%;
			float: right;
			border-left: 1px solid #CCCCCC;
			.wpsj {
				width: 100%;
				height: 50px;
				float: left;
				background: white;
				text-align: center;
				font-size: 20px;
				line-height: 50px;
				border-bottom: 1px solid #CCCCCC;
				border-top: 1px solid #CCCCCC;
				border-right: 1px solid #CCCCCC;
			}
			.btn {
				height: 30px;
				padding: 0 10px;
			}
			.code-search {
				max-width: 150px;
				min-width: 120px;
				height: 30px;
				margin: 10px 0 10px 0;
			}
			.class-page {
				text-align: left;
				margin-top: 10px;
			}
			.search-item {
				display: inline-block;
			}
			.but1 {
				width: 30%;
				height: 50px;
				float: left;
				line-height: 50px;
				margin-left: 10px;
			}
			.search {
				width: 65%;
				height: 50px;
				float: right;
				text-align: right;
			}
			.search1{
			width: 50%;
			height: 50px;
			float: right;
			line-height: 50px;
			margin-right: 52px;
			text-align: right;
			}
			.el-button+.el-button {
				margin-left: 0px;
			}
		}
	}
</style>